$(function() {
	if (checkLogin()) {
		toLogin("?html=canInterviewResumes.html")
		return;
		//window.location.href = "login.html?html=canInterviewResumes.html"
	}

	$.ajax({
		url: path + "companyPosition/selectCanInterviewResumes",
		type: "POST",
		data: {
			"statue": 0
		},
		dataType: "json",
		crossDomain: true,
		xhrFields: {
			withCredentials: true
		},
		async: false,
	}).done(function(data) {
		if (data != undefined) {

			$.each(data, function(i, v) {
				var d = v
				//console.log("id为" + v)
				if (v.jianLi != undefined) {
					j = v.jianLi
					w = v.workExperience
					e = v.education
					// $("#jianliList").append(
					// 	'<li data-id="1686182" class="onlineResume"><label class="checkbox"><input type="checkbox"><i></i></label>' +
					// 	'<div class="resumeShow"><a title="预览在线简历" target="_blank" class="resumeImg" href="resumeView.html?id=' +
					// 	j.userId + '"><img ' +
					// 	'src="' + path + d.userImg +
					// 	'"></a><div class="resumeIntro"><h3 class="unread"><a target="_blank" title="预览' + j.name + '的简历" ' +
					// 	'href="resumeView.html?id=' + j.userId + '">' + j.name + '的简历 </a><em></em></h3><span class="fr">投递时间：' +
					// 	d.toudiTime + '</span><div>' + j.name + ' / ' + j.gender +
					// 	' / ' + j.topDegree + ' / ' + j.workyear + '<br>' + w.positionName + ' · ' + w.companyName + ' | ' + e.professionalName +
					// 	' · ' + e.schoolName + ' </div><div class="jdpublisher"><span>应聘职位：<a title="' + d.toudiPosition + '"' +
					// 	' target="_blank" href="jobdetail.html?id=' + d.positionId + '">' + d.toudiPosition +
					// 	'</a></span></div></div><div class="links"><a data-deliverid="1686182" ' +
					// 	'data-name="jason" data-positionid="149594" data-email="888888888@qq.com" class="resume_notice" href="javascript:void(0)" onclick="inform(' +
					// 	j.userId + "," + d.positionId + ')">通知面试</a><a data' +
					// 	'-deliverid="1686182" class="resume_refuse" href="javascript:void(0) "onclick="notAdap(' + j.userId + ',' +
					// 	d.positionId + ')">不合适</a><a  data-positionname="' + j.name + '" ' +
					// 	'data-deliverid="1686182" data-positionid="149594" data-resumekey="1ccca806e13637f7b1a4560f80f08057" data-forwardcount="1" ' +
					// 	'class="resume_forward" href="javascript:void(0)">转发 <span>(1人)</span></a></div></div><div class="contactInfo"><span class="c9">' +
					// 	'电话：</span>' + j.tel + ' &nbsp;&nbsp;&nbsp;<span class="c9">邮箱：</span><span>' + j.email + '</span>' +
					// 	'</div></li>')
					
					
					$("#jianliList").append(
						'<li data-id="1686182" class="onlineResume"><label class="checkbox"><input type="checkbox"><i></i></label>' +
						'<div class="resumeShow"><a title="预览在线简历" target="_blank" class="resumeImg" href="resumeView.html?id=' +
						j.userId + '"><img ' +
						'src="' + path + d.userImg +
						'"></a><div class="resumeIntro"><h3 class="unread"><a target="_blank" title="预览' + j.name + '的简历" ' +
						'href="resumeView.html?id=' + j.userId + '">' + j.name + '的简历 </a><em></em></h3><span class="fr">投递时间：' +
						d.toudiTime + '</span><div>' + j.name + ' / ' + j.gender +
						' / ' + j.topDegree + ' / ' + j.workyear + '<br>' + w.positionName + ' · ' + w.companyName + ' | ' + e.professionalName +
						' · ' + e.schoolName + ' </div><div class="jdpublisher"><span>应聘职位：<a title="' + d.toudiPosition + '"' +
						' target="_blank" href="jobdetail.html?id=' + d.positionId + '">' + d.toudiPosition +
						'</a></span></div></div><div class="links"><a data-deliverid="'+j.userId+'" ' +
						'data-name="'+j.name+'" data-positionid="'+d.positionId+'" data-email="'+j.email+'" class="resume_notice" href="javascript:void(0)">通知面试</a><a data' +
						'-deliverid="1686182" class="resume_refuse" href="javascript:void(0) "onclick="notAdap(' + j.userId + ',' +
						d.positionId + ')">不合适</a><a  data-positionname="' + j.name + '" ' +
						'data-deliverid="1686182" data-positionid="149594" data-resumekey="1ccca806e13637f7b1a4560f80f08057" data-forwardcount="1" ' +
						'class="resume_forward" href="javascript:void(0)">转发 <span>(1人)</span></a></div></div><div class="contactInfo"><span class="c9">' +
						'电话：</span>' + j.tel + ' &nbsp;&nbsp;&nbsp;<span class="c9">邮箱：</span><span>' + j.email + '</span>' +
						'</div></li>')
					
				}
			})
		}
	})
})

function inform(userId, positionId) {
	var r = confirm("您确定您的操作吗？")
	if (r) {
		$.ajax({
			url: path + "companyPosition/informFace",
			type: "POST",
			data: {
				"userId": userId,
				"positionId": positionId
			},
			dataType: "json",
			crossDomain: true,
			xhrFields: {
				withCredentials: true
			},
			async: false,
		}).done(function(data) {
			if (data.success != undefined) {
				window.location.reload();
			} else {
				alert(data.msg)
			}
		})
	}
}

function notAdap(userId, positionId) {
	var r = confirm("您确定您的操作吗？")
	if (r) {
		$.ajax({
			url: path + "companyPosition/notAdap",
			type: "POST",
			data: {
				"userId": userId,
				"positionId": positionId
			},
			dataType: "json",
			crossDomain: true,
			xhrFields: {
				withCredentials: true
			},
			async: false,
		}).done(function(data) {
			if (data.success != undefined) {
				window.location.reload();
			} else {
				alert(data.msg)
			}
		})
	}
}
